<?php

namespace App\Containers\AppSection\Accreditation\Models;

use App\Containers\AppSection\Profile\Models\Profile;
use App\Ship\Parents\Models\Model;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
 * Заметки
 *
 * @property int $id Id
 * @property int $profile_id Профиль
 * @property int $accreditation_id Аккредитация
 * @property array $message Замечание
 * @property Carbon $created_at Время создания
 * @property Carbon $updated_at Время обновления
 *
 * @property Profile $profile Профиль
 * @property Accreditation $accreditation Аккредитация
 */
class Remark extends Model
{
    protected $fillable = [
        'profile_id',
        'accreditation_id',
        'message'
    ];

    protected $table = 'accreditation_remarks';

    protected $dates = [
        'created_at',
        'updated_at',
    ];

    /**
     * A resource key to be used in the serialized responses.
     */
    protected string $resourceKey = 'Remark';

    /**
     * Профиль
     * @return BelongsTo Profile
     */
    public function profile(): BelongsTo
    {
        return $this->belongsTo(Profile::class, 'profile_id', 'id');
    }

    /**
     * Аккредитация
     * @return BelongsTo Accreditation
     */
    public function accreditation(): BelongsTo
    {
        return $this->belongsTo(Accreditation::class, 'accreditation_id', 'id');
    }
}
